// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vuex from 'vuex';
import store from './store'
import iView from 'iview';
import 'iview/dist/styles/iview.css'; 
import bus from '@/components/draw/bus.js'
import '@/assets/css/base.css'

Vue.use(Vuex);
Vue.use(iView);

Vue.config.productionTip = false
Vue.prototype.$bus = bus;
Vue.directive('clickoutside',{
  bind(el,binding,vnode){
    function handler(e){
      if(el.contains(e.target)){
        return false;
      }
      if(binding.expression){
        binding.value(e)
      }
    }
    el.__vueClickOutside__ = handler;
    document.addEventListener('click',handler);
  },
  update(){},
  unbind(el,binding){
    document.removeEventListener('click',el.__vueClickOutside__);
    delete el.__vueClickOutside__;
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
